package com.nexgo.payment.trans.setting.othersfunc;

import android.os.Bundle;

import com.nexgo.payment.R;
import com.nexgo.payment.constrant.TransType;
import com.nexgo.payment.trans.download.DownloadTransActivity;
import com.nexgo.payment.ui.ListMenuActivity;
import com.nexgo.payment.util.UIUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 下载菜单界面
 * @author 谭忠扬-YuriTam
 * @time 2017年8月15日
 */
public class SetupDownloadMenuActivity extends ListMenuActivity {
    private static final String TAG = SetupDownloadMenuActivity.class.getSimpleName();

    private List<Integer> mItemList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        initView();
    }

    @Override
    protected String getActivityTitle() {
        return getString(R.string.download_menu);
    }

    @Override
    protected void onItemClick(int position) {
        if (UIUtils.isDoubleClick()) {
            return;
        }
        int item = mItemList.get(position);
        switch (item){
            case R.string.trans_test:
                startActivity(DownloadTransActivity.newInstance(this, TransType.TRANS_TEST));
                break;
            case R.string.download_parameter:
                startActivity(DownloadTransActivity.newInstance(this, TransType.PARAM_DOWN));
                break;
            case R.string.upload_state:
                startActivity(DownloadTransActivity.newInstance(this, TransType.UPLOAD_STATE));
                break;
            case R.string.download_aid:
                startActivity(DownloadTransActivity.newInstance(this, TransType.AID_DOWN));
                break;
            case R.string.download_capk:
                startActivity(DownloadTransActivity.newInstance(this, TransType.CAPK_DOWN));
                break;
            case R.string.download_blacklist:
                startActivity(DownloadTransActivity.newInstance(this, TransType.BLACKLIST_DOWN));
                break;
            case R.string.download_rf_parameter:
                startActivity(DownloadTransActivity.newInstance(this, TransType.RF_PARAM_DOWN));
                break;
            case R.string.download_free_password_card_bin_append:
                startActivity(DownloadTransActivity.newInstance(this, TransType.QPS_BIN_B_DOWN));
                break;
            case R.string.download_free_password_blacklist:
                startActivity(DownloadTransActivity.newInstance(this, TransType.QPS_BIN_C_DOWN));
                break;
            default:
                break;
        }
    }

    private void initView() {
        mItemList = new ArrayList<>();
        mItemList.add(R.string.trans_test);
        mItemList.add(R.string.download_parameter);
        mItemList.add(R.string.upload_state);
        mItemList.add(R.string.download_aid);
        mItemList.add(R.string.download_capk);
        mItemList.add(R.string.download_blacklist);
        mItemList.add(R.string.download_rf_parameter);
        mItemList.add(R.string.download_free_password_card_bin_append);
        mItemList.add(R.string.download_free_password_blacklist);
        for (Integer i : mItemList) {
            addItem(i);
        }
    }
}
